package riceSystem.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import riceSystem.dao.DaoTemplateInterface;
import riceSystem.entity.Address;
import riceSystem.exception.RunException;
import riceSystem.service.ServiceTemplateInterface;
@Component("addressService")
public class AddressServiceImpl implements ServiceTemplateInterface<Address> {
	
	private DaoTemplateInterface<Address> addressDao;
	
	public DaoTemplateInterface<Address> getAddressDao() {
		return addressDao;
	}
	@Resource(name="addressDao")
	public void setAddressDao(DaoTemplateInterface<Address> addressDao) {
		this.addressDao = addressDao;
	}

	public void add(Address t) throws RunException {
		addressDao.save(t);
	}

	public void removeById(long id) throws RunException {
		addressDao.deleteById(id);
	}

	public void remove(Address t) throws RunException {
		addressDao.delete(t);
	}

	public long update(Address t) throws RunException {
		return addressDao.update(t);
	}

	public Address getById(long id) throws RunException {
		return addressDao.loadById(id);
	}

	public List<Address> getAll() throws RunException {
		return addressDao.loadAll();
	}
}
